import { API, API_GENERATE } from '../../config/api';
import HTTP from '../../utils/http'
export default request = {

	//获取报表列表
	async getReportList (params) {
		const reportsList = await HTTP.POST(API_GENERATE(API.GET_REPORT_LIST), params);

		if (reportsList) {
			return reportsList;
		}
		return false;
	},

	//获取报表详情
	async getReportDetail (params) {
		const detail = await HTTP.POST(API_GENERATE(API.GET_REPORT_DETAIL), params);
		if (detail) {
			return detail;
		}
		return false;
	},

	//已收藏列表
	async getCollectList (params) {
		const collectList = await HTTP.POST(API_GENERATE(API.GET_COLLECT_LIST), params, {
			rejectError: false,
			handleError: true,
		});

		if (collectList) {
			return collectList;
		}
		return false;
	},

	//收藏/取消收藏
	async collect (params) {
		const collectResult = await HTTP.POST(API_GENERATE(API.ADD_OR_REMOVE_ATTENTION), params);
		if (collectResult) {
			return collectResult
		}
		return false;
	},

	//置顶或取消置顶
	async setTop (id) {
		const setTopResult = await HTTP.POST(API_GENERATE(API.SET_REPORT_TO_TOP), { rptId: id });
		if (setTopResult) {
			return setTopResult
		}
		return false;
	}
}